﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.ObjectModel.Screens;
using Infrastructure.ObjectModel;
using B10_Ex02_Elad_034695114_Meyron_026607788.ObjectModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using B10_Ex02_EladLebovitch_034695114.ObjectModel;

namespace B10_Ex02_EladLebovitch_034695114.Screens
{
    public class PauseScreen : GameScreen
    {
        private SpriteFont m_PauseFont;
        private SpriteFont m_ResumeFont;
        private Vector2 m_MessagePosition;

        public PauseScreen(Game i_Game)
            : base(i_Game)
        {
            this.IsModal = true;
            this.IsOverlayed = true;
            this.BlackTintAlpha = 60;
        }

        protected override void LoadContent()
        {
            base.LoadContent();
            m_PauseFont = ContentManager.Load<SpriteFont>(@"Fonts\ReadyFont");
            m_ResumeFont = ContentManager.Load<SpriteFont>(@"Fonts\InstuctionsFont");
        }

        public override void Initialize()
        {
            base.Initialize();

            // Set the positions for the text
            m_MessagePosition = new Vector2(90, CenterOfViewPort.Y - 100);
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            SpriteBatch.Begin();
            SpriteBatch.DrawString(m_PauseFont, 
                                    "- Game paused -", m_MessagePosition, Color.Red);
            SpriteBatch.DrawString(m_ResumeFont, "Press R to resume", CenterOfViewPort, Color.White);
            SpriteBatch.End();
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            // Check how much time passed
            if (InputManager.KeyPressed(Microsoft.Xna.Framework.Input.Keys.R))
            {
                this.ExitScreen();
            }
        }
    }
}